﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;

namespace KPIS.GERP.Models.SYS
{
    [DataContract, Table("SysMessage")]

    public class Message
    {

        public Message()
        {
            RecordStatus = "U";
        }

        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity), DataMember,
         Display(Name = "MessageId", ResourceType = typeof (Resources.MessageResource))]
        public int MessageId { get; set; }

        [DataMember, Display(Name = "Code", ResourceType = typeof (Resources.MessageResource))]
        public string Code { get; set; }

        [DataMember, Display(Name = "Date", ResourceType = typeof (Resources.MessageResource))]
        public DateTime? Date { get; set; }

        [DataMember, Display(Name = "Title", ResourceType = typeof (Resources.MessageResource))]
        public string Title { get; set; }

        [DataMember, Display(Name = "Description", ResourceType = typeof (Resources.MessageResource))]
        public string Description { get; set; }

        [ForeignKey("FromEmployee"), DataMember, Display(Name = "FromEmpId", ResourceType = typeof (Resources.MessageResource))]
        public int? FromEmpId { get; set; }

        [ForeignKey("ToEmployee"), DataMember, Display(Name = "ToEmpId", ResourceType = typeof (Resources.MessageResource))]
        public int? ToEmpId { get; set; }

        [DataMember, Display(Name = "FromMessageID", ResourceType = typeof (Resources.MessageResource))]
        public int? FromMessageId { get; set; }

        [DataMember, Display(Name = "RuleApproveID", ResourceType = typeof (Resources.MessageResource))]
        public int? RuleApproveID { get; set; }

        [DataMember, Display(Name = "Remarks", ResourceType = typeof (Resources.MessageResource))]
        public string Remarks { get; set; }

        [DataMember, Display(Name = "MessageStatus", ResourceType = typeof (Resources.MessageResource))]
        public MessageWarningStatus MessageStatus { get; set; }

        [ForeignKey("ApprovalTaskDtl"), DataMember]
        public int? ApprovalTaskDtlId { get; set; }

        [ForeignKey("ApproveProcess"), DataMember]
        public int? AppPrcId { get; set; }

        [DataMember]
        public virtual ApprovalTaskDtl ApprovalTaskDtl { get; set; }

        [DataMember]
        public ApproveProcess ApproveProcess { get; set; }

        [DataMember, Display(Name = "FromEmpId", ResourceType = typeof (Resources.MessageResource))]
        public HRM.Employee FromEmployee { get; set; }

        [DataMember, Display(Name = "ToEmpId", ResourceType = typeof (Resources.MessageResource))]
        public HRM.Employee ToEmployee { get; set; }

        /* debug */

        [DataMember]
        public int ActionCount { get; set; }

        [DataMember]
        public int RuleApprove { get; set; }

        [DataMember]
        public int ApprovalTask { get; set; }

        /* end debug */

        #region

        [EnumDataType(typeof (SYS.RecordStatus.EnumRecordStatus)), DataMember,
         Display(Name = "RecordStatus", ResourceType = typeof (Resources.RecordStatusResource))]
        public string RecordStatus { get; set; }

        public int? CreatedBy { get; set; }
        public DateTime? CreatedWhen { get; set; }
        public int? UpdatedBy { get; set; }
        public DateTime? UpdatedWhen { get; set; }

        #endregion
    }
}